package com.glsc.ngateway.ldap.log;

import com.glsc.ngateway.common.base.weblog.MDCUtil;
import com.glsc.ngateway.common.base.weblog.WebLogService;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.Duration;
import java.time.LocalDateTime;


@Aspect
@Component
public class WebLogAspect {

    @Resource
    private WebLogService webLogService;

    @Pointcut("execution(public * com.glsc.ngateway.ldap.controller..*.*(..))")
    public void webLog() {
    }

    @Around("webLog()")
    public Object aroundAdvice(ProceedingJoinPoint point) throws Throwable {
        return webLogService.aroundAdvice(point, "ldap");
    }


}
